package com.shrct.businessprocess.product.impl;

import com.shrct.businessprocess.organization.RCEnterprise;
import com.shrct.businessprocess.organization.impl.RCEnterpriseImpl;
import com.shrct.businessprocess.product.RCIdentifiableNormalProductEntry;
import com.shrct.businessprocess.product.RCProductSpecification;
import com.shrct.businessprocess.product.RCUnregisterIdentifiableNormalPruductEvent;
import com.shrct.businessprocess.product.impl.RCIdentifiableNormalProductEntryEventImpl;
import com.shrct.businessprocess.product.proxy.RCUnregisterIdentifiableNormalPruductEventProxy;
import edu.fudan.mylang.pf.IObjectFactory;
import javax.persistence.CascadeType;
import javax.persistence.DiscriminatorValue;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import org.eclipse.xtext.xbase.lib.Procedures.Procedure1;

@Entity
@DiscriminatorValue("RCUNREGISTERIDENTIFIABLENORMALPRUDUCTEVENT_TYPE")
public class RCUnregisterIdentifiableNormalPruductEventImpl extends RCIdentifiableNormalProductEntryEventImpl implements RCUnregisterIdentifiableNormalPruductEvent {
  public RCUnregisterIdentifiableNormalPruductEventImpl() {
    super();
  }
  
  public RCUnregisterIdentifiableNormalPruductEventImpl(final RCIdentifiableNormalProductEntry product, final RCEnterprise enterprise) {
    super( product);
    this.enterprise = enterprise;
  }
  
  @JoinColumn(name = "enterprise_id")
  @ManyToOne(targetEntity = RCEnterpriseImpl.class, cascade = { CascadeType.MERGE, CascadeType.PERSIST })
  private RCEnterprise enterprise;
  
  public RCEnterprise getEnterprise() {
    return this.enterprise;
  }
  
  public RCUnregisterIdentifiableNormalPruductEvent setEnterprise(final RCEnterprise enterprise) {
    this.enterprise = enterprise;
    return this;			
    
  }
  
  public String getDescription() {
    RCIdentifiableNormalProductEntry _product = this.getProduct();
    RCProductSpecification _type = _product.getType();
    String _entityName = _type.getEntityName();
    String _plus = ("\u578B\u53F7:" + _entityName);
    String _plus_1 = (_plus + ",\u5E8F\u5217\u53F7\uFF1A");
    RCIdentifiableNormalProductEntry _product_1 = this.getProduct();
    String _sid = _product_1.getSid();
    String _plus_2 = (_plus_1 + _sid);
    return _plus_2;
  }
  
  public String getEventTitle() {
    return "\u4EA7\u54C1\u51FA\u5E93";
  }
  
  public static RCUnregisterIdentifiableNormalPruductEvent create(final RCIdentifiableNormalProductEntry product, final RCEnterprise enterprise, final IObjectFactory objectFactory) {
    com.shrct.businessprocess.product.RCUnregisterIdentifiableNormalPruductEvent rCUnregisterIdentifiableNormalPruductEvent = new com.shrct.businessprocess.product.impl.RCUnregisterIdentifiableNormalPruductEventImpl(
    	product,enterprise
    );
    objectFactory.create(rCUnregisterIdentifiableNormalPruductEvent);
    return rCUnregisterIdentifiableNormalPruductEvent;			
    
  }
  
  public static RCUnregisterIdentifiableNormalPruductEvent createRCUnregisterIdentifiableNormalPruductEventImpl(final RCIdentifiableNormalProductEntry product, final RCEnterprise enterprise, final IObjectFactory objectFactory, final Procedure1<RCUnregisterIdentifiableNormalPruductEvent> init) {
    com.shrct.businessprocess.product.RCUnregisterIdentifiableNormalPruductEvent rCUnregisterIdentifiableNormalPruductEvent = new com.shrct.businessprocess.product.impl.RCUnregisterIdentifiableNormalPruductEventImpl(
    	product,enterprise
    );
    objectFactory.create(rCUnregisterIdentifiableNormalPruductEvent);
    init.apply(rCUnregisterIdentifiableNormalPruductEvent);
    
    return rCUnregisterIdentifiableNormalPruductEvent;			
    
  }
  
  public RCUnregisterIdentifiableNormalPruductEventProxy toProxy() {
    com.shrct.businessprocess.product.proxy.RCUnregisterIdentifiableNormalPruductEventProxy proxy = new com.shrct.businessprocess.product.proxy.RCUnregisterIdentifiableNormalPruductEventProxy();
    proxy.setId(this.getId());
    if(this instanceof edu.fudan.mylang.pf.INamedModelObject){
    	proxy.setName(((edu.fudan.mylang.pf.INamedModelObject)this).getEntityName());
    }
    return proxy;
    
  }
}
